home *** CD-ROM | disk | FTP | other *** search
- /* PurgeEvents.thor by Troels Walsted Hansen
- ** $VER: PurgeEvents.thor v1.30 (03.12.94)
- **
- ** Remove all events at one BBS in THOR. Useful when testing
- ** event creating scripts. :)
- **
- ** History:
- ** PurgeEvents.thor v1.21 (19.11.94)
- ** · Works with THOR v2.0.
- **
- ** PurgeEvents.thor v1.30 (03.12.94)
- ** · removed obsolete code
- ** · will now remove all events no matter *what*
- ** use with caution! :^)
- */
-
- options results
-
- /* needs THOR and bbsread.library functions */
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- if ~show('p', 'BBSREAD') then
- do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- address(thorport)
-
- CURRENTBBS stem CURRENT
- if(rc ~= 0 | CURRENT.BBSNAME ~= "") then bbs = CURRENT.BBSNAME
- else exit
-
- REQUESTNOTIFY TEXT '"'||'Do you really want to delete\nall events at '||bbs||?'"' BT '"_No|_Yes"'
- if(result = 1) then exit
-
- /* mark all events as deleted */
-
- address(bbsread)
-
- GETBBSDATA '"'bbs'"' stem BBSDATA
- if(rc ~= 0) then
- do
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit 5
- end
-
- do i=BBSDATA.FIRSTEVENT to BBSDATA.LASTEVENT
- UPDATEBREVENT BBSNAME '"'bbs'"' EVENTNR i SETDELETED
- if(rc ~= 0) then
- do
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit 5
- end
- end
-
- /* tell bbsread.library to remove the marked events permanently */
-
- PACKDATAFILE BBSNAME '"'bbs'"' EVENTDATA /*SHOWPROGRESS*/
- if(rc ~= 0) then
- do
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit 5
- end
-
- /* update THOR's startupwindow-bbslist-flags */
-
- address(thorport)
- RESCAN
-
- exit
-